
package Boundry;

import java.awt.Color;
import java.awt.Component;
import java.awt.SystemColor;

import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTextField;
import javax.swing.JTextPane;
import javax.swing.border.LineBorder;

import Boundry.GenericTools.GenericTabel;
import Boundry.GenericTools.IPanelOperation;
import Boundry.GenericTools.InputPanel;
import Boundry.GenericTools.RequestInfoAndInputPanel;
import Controllers.GlobalData;
import Controllers.GenericToolsForController.PDFDocument;
import Controllers.GenericToolsForController.PDFfile;
import Entity.Request;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JTextArea;
import javax.swing.JComboBox;
import javax.swing.JRadioButton;
import javax.swing.border.TitledBorder;
import javax.swing.UIManager;

public class EvaluationReportPanel extends RequestInfoAndInputPanel implements IPanelOperation
{
	protected JTextArea txtAreaDesiredChange;
	protected JTextArea txtAreaDescription;
	protected JTextArea txtAreaLocation;
	protected JLabel lblFieldMissingLocation;
	protected JLabel lblFieldMissingDescription;
	protected JLabel lblFieldMissingResult;
	protected JLabel lblFieldMissingRisks;
	protected JLabel lblTimeEstimation;
	protected JComboBox cmbBoxSetTime;
	protected JLabel lblFieldMissingTimeEstimation;
	protected JLabel lblEnterEvaluationReport;
	protected JLabel lblFieldsMissingWarningText;
	protected JScrollPane scrlpnLocation;
	protected JScrollPane scrlpnResult;
	protected JScrollPane scrlpnRisks;
	protected JScrollPane scrlpnDescription;
	protected JTextArea txtAreaRisks;
	protected JPanel jpnlEnterTextPanel;
	protected JLabel lblLocation;
	protected JLabel lblDescription;
	protected JLabel lblDesiredResult;
	protected JLabel lblNewLabel;
	
	


	public EvaluationReportPanel() 
	{
		super();
		pnlUpperPanel.setBackground(SystemColor.menu);
		taNote.setLocation(110, 123);
		taCurrentState.setLocation(452, 70);
		taExcuse.setLocation(452, 23);
		lbHeader.setLocation(10, 0);
		pnlUpperPanel.setBounds(10, 22, 876, 173);
		pnlUpperPanel.setBorder(new TitledBorder(UIManager.getBorder("TitledBorder.border"), "", TitledBorder.LEADING, TitledBorder.TOP, null, null));
		btnAskForMoreTime.setText("");
		EvaluationReportPanelInit();
		MINDAYSALLOWED = 3;
		MAXDAYSALLOWED = 14;
		enterDataToComboBox();
		hideWarnings();
		
	}
		
	public void	EvaluationReportPanelInit() 
	{

		jpnlEnterTextPanel = new JPanel();
		lblFieldMissingLocation = new JLabel("!!!");
		lblFieldMissingResult = new JLabel("!!!");
		lblFieldMissingRisks = new JLabel("!!!");
		scrlpnLocation = new JScrollPane();
		txtAreaLocation = new JTextArea();
		scrlpnResult = new JScrollPane();
		txtAreaDesiredChange = new JTextArea();
		scrlpnRisks = new JScrollPane();
		lblFieldMissingTimeEstimation = new JLabel("!!!");
		txtAreaRisks = new JTextArea();
		scrlpnDescription = new JScrollPane();
		txtAreaDescription = new JTextArea();
		lblEnterEvaluationReport = new JLabel("Enter Evaluation Report");
		lblFieldsMissingWarningText = new JLabel("Please fill all fields");
		lblLocation = new JLabel("Location of fix:");
		lblDescription = new JLabel("Description:");
		lblDesiredResult = new JLabel("Desired Result:");
		lblNewLabel = new JLabel("Risks and Limitations:");
		lblFieldMissingDescription = new JLabel("!!!");
		lblTimeEstimation = new JLabel("Time estimation (Days)");
		pnlLowerPanel = new JPanel();
		cmbBoxSetTime = new JComboBox();

		
		jpnlEnterTextPanel.setBounds(91, 0, 569, 136);
		pnlLowerPanel.add(jpnlEnterTextPanel);
		jpnlEnterTextPanel.setLayout(null);

		lblFieldMissingLocation.setForeground(Color.RED);
		lblFieldMissingLocation.setFont(new Font("Tahoma", Font.PLAIN, 18));
		lblFieldMissingLocation.setBounds(143, 21, 23, 23);
		jpnlEnterTextPanel.add(lblFieldMissingLocation);
		
		lblFieldMissingDescription.setForeground(Color.RED);
		lblFieldMissingDescription.setFont(new Font("Tahoma", Font.PLAIN, 18));
		lblFieldMissingDescription.setBounds(140, 49, 23, 23);
		jpnlEnterTextPanel.add(lblFieldMissingDescription);
		
		
		lblFieldMissingResult.setForeground(Color.RED);
		lblFieldMissingResult.setFont(new Font("Tahoma", Font.PLAIN, 18));
		lblFieldMissingResult.setBounds(140, 77, 23, 23);
		jpnlEnterTextPanel.add(lblFieldMissingResult);
		
		lblFieldMissingRisks.setForeground(Color.RED);
		lblFieldMissingRisks.setFont(new Font("Tahoma", Font.PLAIN, 18));
		lblFieldMissingRisks.setBounds(140, 107, 23, 23);
		jpnlEnterTextPanel.add(lblFieldMissingRisks);
		
		scrlpnLocation.setBounds(173, 11, 386, 23);
		jpnlEnterTextPanel.add(scrlpnLocation);
	
		scrlpnLocation.setViewportView(txtAreaLocation);
		
		scrlpnResult.setBounds(173, 77, 386, 23);
		jpnlEnterTextPanel.add(scrlpnResult);
		
		scrlpnResult.setViewportView(txtAreaDesiredChange);
		
		scrlpnRisks.setBounds(173, 111, 396, 25);
		jpnlEnterTextPanel.add(scrlpnRisks);
		
		scrlpnRisks.setColumnHeaderView(txtAreaRisks);
		
		scrlpnDescription.setBounds(176, 42, 383, 30);
		jpnlEnterTextPanel.add(scrlpnDescription);
		
		scrlpnDescription.setViewportView(txtAreaDescription);
		
		lblTimeEstimation.setBounds(670, 22, 117, 14);
		pnlLowerPanel.add(lblTimeEstimation);
		
		lblEnterEvaluationReport.setBounds(20, 206, 147, 14);
		mainPanel.add(lblEnterEvaluationReport);
		
		lblFieldsMissingWarningText.setForeground(Color.RED);
		lblFieldsMissingWarningText.setFont(new Font("Tahoma", Font.PLAIN, 16));
		lblFieldsMissingWarningText.setBounds(303, 11, 221, 32);
		buttonPanel.add(lblFieldsMissingWarningText);
				
		lblLocation.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblLocation.setBounds(10, 11, 112, 14);
		jpnlEnterTextPanel.add(lblLocation);
		
		lblDescription.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblDescription.setBounds(10, 47, 112, 14);
		jpnlEnterTextPanel.add(lblDescription);
		
		lblDesiredResult.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblDesiredResult.setBounds(10, 77, 130, 14);
		jpnlEnterTextPanel.add(lblDesiredResult);
		
		lblNewLabel.setFont(new Font("Tahoma", Font.PLAIN, 14));
		lblNewLabel.setBounds(10, 111, 153, 14);
		jpnlEnterTextPanel.add(lblNewLabel);
		pnlLowerPanel.setBounds(37, 232, 808, 147);
		mainPanel.add(pnlLowerPanel);
		pnlLowerPanel.setLayout(null);	
		
		lblFieldMissingTimeEstimation.setForeground(Color.RED);
		lblFieldMissingTimeEstimation.setFont(new Font("Tahoma", Font.PLAIN, 18));
		lblFieldMissingTimeEstimation.setBounds(714, 0, 23, 23);
		pnlLowerPanel.add(lblFieldMissingTimeEstimation);
		cmbBoxSetTime.setBounds(691, 47, 75, 20);
		pnlLowerPanel.add(cmbBoxSetTime);
		btnAskForMoreTime.setVisible(true);
		this.btnAskForMoreTime.setIcon(new ImageIcon(EvaluationReportPanel.class.getResource("/ICONS/10_device_access_time.png")));
		this.btnAskForMoreTime.setBounds(442, 11, 65, 32);
		
	}
	
	

	public JPanel getJpnlEnterTextPanel() {
		return jpnlEnterTextPanel;
	}



	public void setJpnlEnterTextPanel(JPanel jpnlEnterTextPanel) {
		this.jpnlEnterTextPanel = jpnlEnterTextPanel;
	}



	public JLabel getLblNewLabel() {
		return lblNewLabel;
	}



	public void setLblNewLabel(JLabel lblNewLabel) {
		this.lblNewLabel = lblNewLabel;
	}
	
	public JTextArea getTxtAreaRisks()
	{
		return txtAreaRisks;
	}



	public void setTxtAreaRisks(JTextArea txtAreaRisks) 
	{
		this.txtAreaRisks = txtAreaRisks;
	}


	@Override
	public String apHelpButton() {
		  return("Evaluator can view details about the request ");
	}

	@Override
	public String setTitle() {
		 return("Evaluation Report");
	}

	public void enterDataToComboBox() {
		for (int i=MINDAYSALLOWED ; i< MAXDAYSALLOWED ; i++ )
		cmbBoxSetTime.addItem(new Integer(i));
	}



	public void hideWarnings() {
             lblFieldMissingDescription.setVisible(false);
             lblFieldMissingLocation.setVisible(false);
             lblFieldMissingResult.setVisible(false);
             lblFieldMissingRisks.setVisible(false);
             lblFieldMissingTimeEstimation.setVisible(false);
             lblFieldsMissingWarningText.setVisible(false);
	}

	
	public JScrollPane getScrlpnLocation() {
		return scrlpnLocation;
	}



	public void setScrlpnLocation(JScrollPane scrlpnLocation) {
		this.scrlpnLocation = scrlpnLocation;
	}



	public JScrollPane getScrlpnResult() {
		return scrlpnResult;
	}



	public void setScrlpnResult(JScrollPane scrlpnResult) {
		this.scrlpnResult = scrlpnResult;
	}



	public JScrollPane getScrlpnRisks() {
		return scrlpnRisks;
	}



	public void setScrlpnRisks(JScrollPane scrlpnRisks) {
		this.scrlpnRisks = scrlpnRisks;
	}



	public JScrollPane getScrlpnDescription() {
		return scrlpnDescription;
	}



	public void setScrlpnDescription(JScrollPane scrlpnDescription) {
		this.scrlpnDescription = scrlpnDescription;
	}
	

	public JLabel getLblFieldMissingLocation() {
		return lblFieldMissingLocation;
	}



	public void setLblFieldMissingLocation(JLabel lblFieldMissingLocation) {
		this.lblFieldMissingLocation = lblFieldMissingLocation;
	}



	public JLabel getLblFieldMissingDescription() {
		return lblFieldMissingDescription;
	}



	public void setLblFieldMissingDescription(JLabel lblFieldMissingDescription) {
		this.lblFieldMissingDescription = lblFieldMissingDescription;
	}



	public JLabel getLblFieldMissingResult() {
		return lblFieldMissingResult;
	}



	public void setLblFieldMissingResult(JLabel lblFieldMissingResult) {
		this.lblFieldMissingResult = lblFieldMissingResult;
	}



	public JLabel getLblFieldMissingRisks() {
		return lblFieldMissingRisks;
	}



	public void setLblFieldMissingRisks(JLabel lblFieldMissingRisks) {
		this.lblFieldMissingRisks = lblFieldMissingRisks;
	}



	public JLabel getLblTimeEstimation() {
		return lblTimeEstimation;
	}



	public void setLblTimeEstimation(JLabel lblTimeEstimation) {
		this.lblTimeEstimation = lblTimeEstimation;
	}



	public JComboBox getCmbBoxSetTime() {
		return cmbBoxSetTime;
	}



	public void setCmbBoxSetTime(JComboBox cmbBoxSetTime) {
		this.cmbBoxSetTime = cmbBoxSetTime;
	}



	public JLabel getLblFieldMissingTimeEstimation() {
		return lblFieldMissingTimeEstimation;
	}



	public void setLblFieldMissingTimeEstimation(
			JLabel lblFieldMissingTimeEstimation) {
		this.lblFieldMissingTimeEstimation = lblFieldMissingTimeEstimation;
	}



	public JLabel getLblEnterEvaluationReport() {
		return lblEnterEvaluationReport;
	}



	public void setLblEnterEvaluationReport(JLabel lblEnterEvaluationReport) {
		this.lblEnterEvaluationReport = lblEnterEvaluationReport;
	}
	
	public JLabel getLblFieldsMissingWarningText() {
		return lblFieldsMissingWarningText;
	}



	public void setLblFieldsMissingWarningText(JLabel lblFieldsMissingWarningText) {
		this.lblFieldsMissingWarningText = lblFieldsMissingWarningText;
	}

	public JTextArea getTxtAreaDesiredChange() {
		return txtAreaDesiredChange;
	}

	public void setTxtAreaDesiredChange(JTextArea txtAreaDesiredChange) {
		this.txtAreaDesiredChange = txtAreaDesiredChange;
	}

	public JTextArea getTxtAreaDescription() {
		return txtAreaDescription;
	}

	public void setTxtAreaDescription(JTextArea txtAreaDescription) {
		this.txtAreaDescription = txtAreaDescription;
	}

	public JTextArea getTxtAreaLocation() {
		return txtAreaLocation;
	}

	public void setTxtAreaLocation(JTextArea txtAreaLocation) {
		this.txtAreaLocation = txtAreaLocation;
	}


	public JLabel getLblLocation() {
		return lblLocation;
	}

	public void setLblLocation(JLabel lblLocation) {
		this.lblLocation = lblLocation;
	}

	public JLabel getLblDescription() {
		return lblDescription;
	}

	public void setLblDescription(JLabel lblDescription) {
		this.lblDescription = lblDescription;
	}

	public JLabel getLblDesiredResult() {
		return lblDesiredResult;
	}

	public void setLblDesiredResult(JLabel lblDesiredResult) {
		this.lblDesiredResult = lblDesiredResult;
	}

	}

